/*
 * Copyright (c) 2018, NVIDIA CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*
 * Portions of this file are derived from Google's Brotli project at
 * https://github.com/google/brotli, original license text below.
 */

/* Copyright 2013 Google Inc. All Rights Reserved.

Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

/*
Copyright(c) 2009, 2010, 2013 - 2016 by the Brotli Authors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/

#pragma once

#ifndef CONSTANT
#define CONSTANT static const
#endif

constexpr int brotli_num_block_len_symbols = 26;
constexpr int brotli_num_literal_symbols   = 256;
constexpr int brotli_num_command_symbols   = 704;

CONSTANT uint8_t kReverseBits[1 << 8] = {
  0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
  0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8,
  0x04, 0x84, 0x44, 0xC4, 0x24, 0xA4, 0x64, 0xE4, 0x14, 0x94, 0x54, 0xD4, 0x34, 0xB4, 0x74, 0xF4,
  0x0C, 0x8C, 0x4C, 0xCC, 0x2C, 0xAC, 0x6C, 0xEC, 0x1C, 0x9C, 0x5C, 0xDC, 0x3C, 0xBC, 0x7C, 0xFC,
  0x02, 0x82, 0x42, 0xC2, 0x22, 0xA2, 0x62, 0xE2, 0x12, 0x92, 0x52, 0xD2, 0x32, 0xB2, 0x72, 0xF2,
  0x0A, 0x8A, 0x4A, 0xCA, 0x2A, 0xAA, 0x6A, 0xEA, 0x1A, 0x9A, 0x5A, 0xDA, 0x3A, 0xBA, 0x7A, 0xFA,
  0x06, 0x86, 0x46, 0xC6, 0x26, 0xA6, 0x66, 0xE6, 0x16, 0x96, 0x56, 0xD6, 0x36, 0xB6, 0x76, 0xF6,
  0x0E, 0x8E, 0x4E, 0xCE, 0x2E, 0xAE, 0x6E, 0xEE, 0x1E, 0x9E, 0x5E, 0xDE, 0x3E, 0xBE, 0x7E, 0xFE,
  0x01, 0x81, 0x41, 0xC1, 0x21, 0xA1, 0x61, 0xE1, 0x11, 0x91, 0x51, 0xD1, 0x31, 0xB1, 0x71, 0xF1,
  0x09, 0x89, 0x49, 0xC9, 0x29, 0xA9, 0x69, 0xE9, 0x19, 0x99, 0x59, 0xD9, 0x39, 0xB9, 0x79, 0xF9,
  0x05, 0x85, 0x45, 0xC5, 0x25, 0xA5, 0x65, 0xE5, 0x15, 0x95, 0x55, 0xD5, 0x35, 0xB5, 0x75, 0xF5,
  0x0D, 0x8D, 0x4D, 0xCD, 0x2D, 0xAD, 0x6D, 0xED, 0x1D, 0x9D, 0x5D, 0xDD, 0x3D, 0xBD, 0x7D, 0xFD,
  0x03, 0x83, 0x43, 0xC3, 0x23, 0xA3, 0x63, 0xE3, 0x13, 0x93, 0x53, 0xD3, 0x33, 0xB3, 0x73, 0xF3,
  0x0B, 0x8B, 0x4B, 0xCB, 0x2B, 0xAB, 0x6B, 0xEB, 0x1B, 0x9B, 0x5B, 0xDB, 0x3B, 0xBB, 0x7B, 0xFB,
  0x07, 0x87, 0x47, 0xC7, 0x27, 0xA7, 0x67, 0xE7, 0x17, 0x97, 0x57, 0xD7, 0x37, 0xB7, 0x77, 0xF7,
  0x0F, 0x8F, 0x4F, 0xCF, 0x2F, 0xAF, 0x6F, 0xEF, 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF};

/* Common context lookup table for all context modes. */
CONSTANT uint8_t kContextLookup[2048] = {
  /* CONTEXT_LSB6, last byte. */
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  0,
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
  11,
  12,
  13,
  14,
  15,
  16,
  17,
  18,
  19,
  20,
  21,
  22,
  23,
  24,
  25,
  26,
  27,
  28,
  29,
  30,
  31,
  32,
  33,
  34,
  35,
  36,
  37,
  38,
  39,
  40,
  41,
  42,
  43,
  44,
  45,
  46,
  47,
  48,
  49,
  50,
  51,
  52,
  53,
  54,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,

  /* CONTEXT_LSB6, second last byte, */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,

  /* CONTEXT_MSB6, last byte. */
  0,
  0,
  0,
  0,
  1,
  1,
  1,
  1,
  2,
  2,
  2,
  2,
  3,
  3,
  3,
  3,
  4,
  4,
  4,
  4,
  5,
  5,
  5,
  5,
  6,
  6,
  6,
  6,
  7,
  7,
  7,
  7,
  8,
  8,
  8,
  8,
  9,
  9,
  9,
  9,
  10,
  10,
  10,
  10,
  11,
  11,
  11,
  11,
  12,
  12,
  12,
  12,
  13,
  13,
  13,
  13,
  14,
  14,
  14,
  14,
  15,
  15,
  15,
  15,
  16,
  16,
  16,
  16,
  17,
  17,
  17,
  17,
  18,
  18,
  18,
  18,
  19,
  19,
  19,
  19,
  20,
  20,
  20,
  20,
  21,
  21,
  21,
  21,
  22,
  22,
  22,
  22,
  23,
  23,
  23,
  23,
  24,
  24,
  24,
  24,
  25,
  25,
  25,
  25,
  26,
  26,
  26,
  26,
  27,
  27,
  27,
  27,
  28,
  28,
  28,
  28,
  29,
  29,
  29,
  29,
  30,
  30,
  30,
  30,
  31,
  31,
  31,
  31,
  32,
  32,
  32,
  32,
  33,
  33,
  33,
  33,
  34,
  34,
  34,
  34,
  35,
  35,
  35,
  35,
  36,
  36,
  36,
  36,
  37,
  37,
  37,
  37,
  38,
  38,
  38,
  38,
  39,
  39,
  39,
  39,
  40,
  40,
  40,
  40,
  41,
  41,
  41,
  41,
  42,
  42,
  42,
  42,
  43,
  43,
  43,
  43,
  44,
  44,
  44,
  44,
  45,
  45,
  45,
  45,
  46,
  46,
  46,
  46,
  47,
  47,
  47,
  47,
  48,
  48,
  48,
  48,
  49,
  49,
  49,
  49,
  50,
  50,
  50,
  50,
  51,
  51,
  51,
  51,
  52,
  52,
  52,
  52,
  53,
  53,
  53,
  53,
  54,
  54,
  54,
  54,
  55,
  55,
  55,
  55,
  56,
  56,
  56,
  56,
  57,
  57,
  57,
  57,
  58,
  58,
  58,
  58,
  59,
  59,
  59,
  59,
  60,
  60,
  60,
  60,
  61,
  61,
  61,
  61,
  62,
  62,
  62,
  62,
  63,
  63,
  63,
  63,

  /* CONTEXT_MSB6, second last byte, */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,

  /* CONTEXT_UTF8, last byte. */
  /* ASCII range. */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  4,
  4,
  0,
  0,
  4,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  8,
  12,
  16,
  12,
  12,
  20,
  12,
  16,
  24,
  28,
  12,
  12,
  32,
  12,
  36,
  12,
  44,
  44,
  44,
  44,
  44,
  44,
  44,
  44,
  44,
  44,
  32,
  32,
  24,
  40,
  28,
  12,
  12,
  48,
  52,
  52,
  52,
  48,
  52,
  52,
  52,
  48,
  52,
  52,
  52,
  52,
  52,
  48,
  52,
  52,
  52,
  52,
  52,
  48,
  52,
  52,
  52,
  52,
  52,
  24,
  12,
  28,
  12,
  12,
  12,
  56,
  60,
  60,
  60,
  56,
  60,
  60,
  60,
  56,
  60,
  60,
  60,
  60,
  60,
  56,
  60,
  60,
  60,
  60,
  60,
  56,
  60,
  60,
  60,
  60,
  60,
  24,
  12,
  28,
  12,
  0,
  /* UTF8 continuation byte range. */
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  0,
  1,
  /* UTF8 lead byte range. */
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,
  2,
  3,

  /* CONTEXT_UTF8 second last byte. */
  /* ASCII range. */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  1,
  1,
  1,
  1,
  1,
  1,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  1,
  1,
  1,
  1,
  0,
  /* UTF8 continuation byte range. */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  /* UTF8 lead byte range. */
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  0,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,

  /* CONTEXT_SIGNED, last byte, same as the above values shifted by 3 bits. */
  0,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  8,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  16,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  24,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  32,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  40,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  48,
  56,

  /* CONTEXT_SIGNED, second last byte. */
  0,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  1,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  2,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  3,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  4,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  5,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  6,
  7,
};

typedef struct CmdLutElement {
  uint8_t insert_len_extra_bits;
  uint8_t copy_len_extra_bits;
  int8_t distance_code;
  uint8_t context;
  uint16_t insert_len_offset;
  uint16_t copy_len_offset;
} CmdLutElement;

CONSTANT CmdLutElement kCmdLut[brotli_num_command_symbols] = {
  {0x00, 0x00, 0, 0x00, 0x0000, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0000, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0000, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0000, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0000, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0000, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0000, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0000, 0x0009},
  {0x00, 0x00, 0, 0x00, 0x0001, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0001, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0001, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0001, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0001, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0001, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0001, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0001, 0x0009},
  {0x00, 0x00, 0, 0x00, 0x0002, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0002, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0002, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0002, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0002, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0002, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0002, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0002, 0x0009},
  {0x00, 0x00, 0, 0x00, 0x0003, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0003, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0003, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0003, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0003, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0003, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0003, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0003, 0x0009},
  {0x00, 0x00, 0, 0x00, 0x0004, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0004, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0004, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0004, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0004, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0004, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0004, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0004, 0x0009},
  {0x00, 0x00, 0, 0x00, 0x0005, 0x0002},  {0x00, 0x00, 0, 0x01, 0x0005, 0x0003},
  {0x00, 0x00, 0, 0x02, 0x0005, 0x0004},  {0x00, 0x00, 0, 0x03, 0x0005, 0x0005},
  {0x00, 0x00, 0, 0x03, 0x0005, 0x0006},  {0x00, 0x00, 0, 0x03, 0x0005, 0x0007},
  {0x00, 0x00, 0, 0x03, 0x0005, 0x0008},  {0x00, 0x00, 0, 0x03, 0x0005, 0x0009},
  {0x01, 0x00, 0, 0x00, 0x0006, 0x0002},  {0x01, 0x00, 0, 0x01, 0x0006, 0x0003},
  {0x01, 0x00, 0, 0x02, 0x0006, 0x0004},  {0x01, 0x00, 0, 0x03, 0x0006, 0x0005},
  {0x01, 0x00, 0, 0x03, 0x0006, 0x0006},  {0x01, 0x00, 0, 0x03, 0x0006, 0x0007},
  {0x01, 0x00, 0, 0x03, 0x0006, 0x0008},  {0x01, 0x00, 0, 0x03, 0x0006, 0x0009},
  {0x01, 0x00, 0, 0x00, 0x0008, 0x0002},  {0x01, 0x00, 0, 0x01, 0x0008, 0x0003},
  {0x01, 0x00, 0, 0x02, 0x0008, 0x0004},  {0x01, 0x00, 0, 0x03, 0x0008, 0x0005},
  {0x01, 0x00, 0, 0x03, 0x0008, 0x0006},  {0x01, 0x00, 0, 0x03, 0x0008, 0x0007},
  {0x01, 0x00, 0, 0x03, 0x0008, 0x0008},  {0x01, 0x00, 0, 0x03, 0x0008, 0x0009},
  {0x00, 0x01, 0, 0x03, 0x0000, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0000, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0000, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0000, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0000, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0000, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0000, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0000, 0x0036},
  {0x00, 0x01, 0, 0x03, 0x0001, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0001, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0001, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0001, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0001, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0001, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0001, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0001, 0x0036},
  {0x00, 0x01, 0, 0x03, 0x0002, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0002, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0002, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0002, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0002, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0002, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0002, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0002, 0x0036},
  {0x00, 0x01, 0, 0x03, 0x0003, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0003, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0003, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0003, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0003, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0003, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0003, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0003, 0x0036},
  {0x00, 0x01, 0, 0x03, 0x0004, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0004, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0004, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0004, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0004, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0004, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0004, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0004, 0x0036},
  {0x00, 0x01, 0, 0x03, 0x0005, 0x000a},  {0x00, 0x01, 0, 0x03, 0x0005, 0x000c},
  {0x00, 0x02, 0, 0x03, 0x0005, 0x000e},  {0x00, 0x02, 0, 0x03, 0x0005, 0x0012},
  {0x00, 0x03, 0, 0x03, 0x0005, 0x0016},  {0x00, 0x03, 0, 0x03, 0x0005, 0x001e},
  {0x00, 0x04, 0, 0x03, 0x0005, 0x0026},  {0x00, 0x04, 0, 0x03, 0x0005, 0x0036},
  {0x01, 0x01, 0, 0x03, 0x0006, 0x000a},  {0x01, 0x01, 0, 0x03, 0x0006, 0x000c},
  {0x01, 0x02, 0, 0x03, 0x0006, 0x000e},  {0x01, 0x02, 0, 0x03, 0x0006, 0x0012},
  {0x01, 0x03, 0, 0x03, 0x0006, 0x0016},  {0x01, 0x03, 0, 0x03, 0x0006, 0x001e},
  {0x01, 0x04, 0, 0x03, 0x0006, 0x0026},  {0x01, 0x04, 0, 0x03, 0x0006, 0x0036},
  {0x01, 0x01, 0, 0x03, 0x0008, 0x000a},  {0x01, 0x01, 0, 0x03, 0x0008, 0x000c},
  {0x01, 0x02, 0, 0x03, 0x0008, 0x000e},  {0x01, 0x02, 0, 0x03, 0x0008, 0x0012},
  {0x01, 0x03, 0, 0x03, 0x0008, 0x0016},  {0x01, 0x03, 0, 0x03, 0x0008, 0x001e},
  {0x01, 0x04, 0, 0x03, 0x0008, 0x0026},  {0x01, 0x04, 0, 0x03, 0x0008, 0x0036},
  {0x00, 0x00, -1, 0x00, 0x0000, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0000, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0000, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0000, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0000, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0000, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0000, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0000, 0x0009},
  {0x00, 0x00, -1, 0x00, 0x0001, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0001, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0001, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0001, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0001, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0001, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0001, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0001, 0x0009},
  {0x00, 0x00, -1, 0x00, 0x0002, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0002, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0002, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0002, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0002, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0002, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0002, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0002, 0x0009},
  {0x00, 0x00, -1, 0x00, 0x0003, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0003, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0003, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0003, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0003, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0003, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0003, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0003, 0x0009},
  {0x00, 0x00, -1, 0x00, 0x0004, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0004, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0004, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0004, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0004, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0004, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0004, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0004, 0x0009},
  {0x00, 0x00, -1, 0x00, 0x0005, 0x0002}, {0x00, 0x00, -1, 0x01, 0x0005, 0x0003},
  {0x00, 0x00, -1, 0x02, 0x0005, 0x0004}, {0x00, 0x00, -1, 0x03, 0x0005, 0x0005},
  {0x00, 0x00, -1, 0x03, 0x0005, 0x0006}, {0x00, 0x00, -1, 0x03, 0x0005, 0x0007},
  {0x00, 0x00, -1, 0x03, 0x0005, 0x0008}, {0x00, 0x00, -1, 0x03, 0x0005, 0x0009},
  {0x01, 0x00, -1, 0x00, 0x0006, 0x0002}, {0x01, 0x00, -1, 0x01, 0x0006, 0x0003},
  {0x01, 0x00, -1, 0x02, 0x0006, 0x0004}, {0x01, 0x00, -1, 0x03, 0x0006, 0x0005},
  {0x01, 0x00, -1, 0x03, 0x0006, 0x0006}, {0x01, 0x00, -1, 0x03, 0x0006, 0x0007},
  {0x01, 0x00, -1, 0x03, 0x0006, 0x0008}, {0x01, 0x00, -1, 0x03, 0x0006, 0x0009},
  {0x01, 0x00, -1, 0x00, 0x0008, 0x0002}, {0x01, 0x00, -1, 0x01, 0x0008, 0x0003},
  {0x01, 0x00, -1, 0x02, 0x0008, 0x0004}, {0x01, 0x00, -1, 0x03, 0x0008, 0x0005},
  {0x01, 0x00, -1, 0x03, 0x0008, 0x0006}, {0x01, 0x00, -1, 0x03, 0x0008, 0x0007},
  {0x01, 0x00, -1, 0x03, 0x0008, 0x0008}, {0x01, 0x00, -1, 0x03, 0x0008, 0x0009},
  {0x00, 0x01, -1, 0x03, 0x0000, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0000, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0000, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0000, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0000, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0000, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0000, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0000, 0x0036},
  {0x00, 0x01, -1, 0x03, 0x0001, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0001, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0001, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0001, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0001, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0001, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0001, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0001, 0x0036},
  {0x00, 0x01, -1, 0x03, 0x0002, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0002, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0002, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0002, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0002, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0002, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0002, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0002, 0x0036},
  {0x00, 0x01, -1, 0x03, 0x0003, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0003, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0003, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0003, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0003, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0003, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0003, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0003, 0x0036},
  {0x00, 0x01, -1, 0x03, 0x0004, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0004, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0004, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0004, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0004, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0004, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0004, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0004, 0x0036},
  {0x00, 0x01, -1, 0x03, 0x0005, 0x000a}, {0x00, 0x01, -1, 0x03, 0x0005, 0x000c},
  {0x00, 0x02, -1, 0x03, 0x0005, 0x000e}, {0x00, 0x02, -1, 0x03, 0x0005, 0x0012},
  {0x00, 0x03, -1, 0x03, 0x0005, 0x0016}, {0x00, 0x03, -1, 0x03, 0x0005, 0x001e},
  {0x00, 0x04, -1, 0x03, 0x0005, 0x0026}, {0x00, 0x04, -1, 0x03, 0x0005, 0x0036},
  {0x01, 0x01, -1, 0x03, 0x0006, 0x000a}, {0x01, 0x01, -1, 0x03, 0x0006, 0x000c},
  {0x01, 0x02, -1, 0x03, 0x0006, 0x000e}, {0x01, 0x02, -1, 0x03, 0x0006, 0x0012},
  {0x01, 0x03, -1, 0x03, 0x0006, 0x0016}, {0x01, 0x03, -1, 0x03, 0x0006, 0x001e},
  {0x01, 0x04, -1, 0x03, 0x0006, 0x0026}, {0x01, 0x04, -1, 0x03, 0x0006, 0x0036},
  {0x01, 0x01, -1, 0x03, 0x0008, 0x000a}, {0x01, 0x01, -1, 0x03, 0x0008, 0x000c},
  {0x01, 0x02, -1, 0x03, 0x0008, 0x000e}, {0x01, 0x02, -1, 0x03, 0x0008, 0x0012},
  {0x01, 0x03, -1, 0x03, 0x0008, 0x0016}, {0x01, 0x03, -1, 0x03, 0x0008, 0x001e},
  {0x01, 0x04, -1, 0x03, 0x0008, 0x0026}, {0x01, 0x04, -1, 0x03, 0x0008, 0x0036},
  {0x02, 0x00, -1, 0x00, 0x000a, 0x0002}, {0x02, 0x00, -1, 0x01, 0x000a, 0x0003},
  {0x02, 0x00, -1, 0x02, 0x000a, 0x0004}, {0x02, 0x00, -1, 0x03, 0x000a, 0x0005},
  {0x02, 0x00, -1, 0x03, 0x000a, 0x0006}, {0x02, 0x00, -1, 0x03, 0x000a, 0x0007},
  {0x02, 0x00, -1, 0x03, 0x000a, 0x0008}, {0x02, 0x00, -1, 0x03, 0x000a, 0x0009},
  {0x02, 0x00, -1, 0x00, 0x000e, 0x0002}, {0x02, 0x00, -1, 0x01, 0x000e, 0x0003},
  {0x02, 0x00, -1, 0x02, 0x000e, 0x0004}, {0x02, 0x00, -1, 0x03, 0x000e, 0x0005},
  {0x02, 0x00, -1, 0x03, 0x000e, 0x0006}, {0x02, 0x00, -1, 0x03, 0x000e, 0x0007},
  {0x02, 0x00, -1, 0x03, 0x000e, 0x0008}, {0x02, 0x00, -1, 0x03, 0x000e, 0x0009},
  {0x03, 0x00, -1, 0x00, 0x0012, 0x0002}, {0x03, 0x00, -1, 0x01, 0x0012, 0x0003},
  {0x03, 0x00, -1, 0x02, 0x0012, 0x0004}, {0x03, 0x00, -1, 0x03, 0x0012, 0x0005},
  {0x03, 0x00, -1, 0x03, 0x0012, 0x0006}, {0x03, 0x00, -1, 0x03, 0x0012, 0x0007},
  {0x03, 0x00, -1, 0x03, 0x0012, 0x0008}, {0x03, 0x00, -1, 0x03, 0x0012, 0x0009},
  {0x03, 0x00, -1, 0x00, 0x001a, 0x0002}, {0x03, 0x00, -1, 0x01, 0x001a, 0x0003},
  {0x03, 0x00, -1, 0x02, 0x001a, 0x0004}, {0x03, 0x00, -1, 0x03, 0x001a, 0x0005},
  {0x03, 0x00, -1, 0x03, 0x001a, 0x0006}, {0x03, 0x00, -1, 0x03, 0x001a, 0x0007},
  {0x03, 0x00, -1, 0x03, 0x001a, 0x0008}, {0x03, 0x00, -1, 0x03, 0x001a, 0x0009},
  {0x04, 0x00, -1, 0x00, 0x0022, 0x0002}, {0x04, 0x00, -1, 0x01, 0x0022, 0x0003},
  {0x04, 0x00, -1, 0x02, 0x0022, 0x0004}, {0x04, 0x00, -1, 0x03, 0x0022, 0x0005},
  {0x04, 0x00, -1, 0x03, 0x0022, 0x0006}, {0x04, 0x00, -1, 0x03, 0x0022, 0x0007},
  {0x04, 0x00, -1, 0x03, 0x0022, 0x0008}, {0x04, 0x00, -1, 0x03, 0x0022, 0x0009},
  {0x04, 0x00, -1, 0x00, 0x0032, 0x0002}, {0x04, 0x00, -1, 0x01, 0x0032, 0x0003},
  {0x04, 0x00, -1, 0x02, 0x0032, 0x0004}, {0x04, 0x00, -1, 0x03, 0x0032, 0x0005},
  {0x04, 0x00, -1, 0x03, 0x0032, 0x0006}, {0x04, 0x00, -1, 0x03, 0x0032, 0x0007},
  {0x04, 0x00, -1, 0x03, 0x0032, 0x0008}, {0x04, 0x00, -1, 0x03, 0x0032, 0x0009},
  {0x05, 0x00, -1, 0x00, 0x0042, 0x0002}, {0x05, 0x00, -1, 0x01, 0x0042, 0x0003},
  {0x05, 0x00, -1, 0x02, 0x0042, 0x0004}, {0x05, 0x00, -1, 0x03, 0x0042, 0x0005},
  {0x05, 0x00, -1, 0x03, 0x0042, 0x0006}, {0x05, 0x00, -1, 0x03, 0x0042, 0x0007},
  {0x05, 0x00, -1, 0x03, 0x0042, 0x0008}, {0x05, 0x00, -1, 0x03, 0x0042, 0x0009},
  {0x05, 0x00, -1, 0x00, 0x0062, 0x0002}, {0x05, 0x00, -1, 0x01, 0x0062, 0x0003},
  {0x05, 0x00, -1, 0x02, 0x0062, 0x0004}, {0x05, 0x00, -1, 0x03, 0x0062, 0x0005},
  {0x05, 0x00, -1, 0x03, 0x0062, 0x0006}, {0x05, 0x00, -1, 0x03, 0x0062, 0x0007},
  {0x05, 0x00, -1, 0x03, 0x0062, 0x0008}, {0x05, 0x00, -1, 0x03, 0x0062, 0x0009},
  {0x02, 0x01, -1, 0x03, 0x000a, 0x000a}, {0x02, 0x01, -1, 0x03, 0x000a, 0x000c},
  {0x02, 0x02, -1, 0x03, 0x000a, 0x000e}, {0x02, 0x02, -1, 0x03, 0x000a, 0x0012},
  {0x02, 0x03, -1, 0x03, 0x000a, 0x0016}, {0x02, 0x03, -1, 0x03, 0x000a, 0x001e},
  {0x02, 0x04, -1, 0x03, 0x000a, 0x0026}, {0x02, 0x04, -1, 0x03, 0x000a, 0x0036},
  {0x02, 0x01, -1, 0x03, 0x000e, 0x000a}, {0x02, 0x01, -1, 0x03, 0x000e, 0x000c},
  {0x02, 0x02, -1, 0x03, 0x000e, 0x000e}, {0x02, 0x02, -1, 0x03, 0x000e, 0x0012},
  {0x02, 0x03, -1, 0x03, 0x000e, 0x0016}, {0x02, 0x03, -1, 0x03, 0x000e, 0x001e},
  {0x02, 0x04, -1, 0x03, 0x000e, 0x0026}, {0x02, 0x04, -1, 0x03, 0x000e, 0x0036},
  {0x03, 0x01, -1, 0x03, 0x0012, 0x000a}, {0x03, 0x01, -1, 0x03, 0x0012, 0x000c},
  {0x03, 0x02, -1, 0x03, 0x0012, 0x000e}, {0x03, 0x02, -1, 0x03, 0x0012, 0x0012},
  {0x03, 0x03, -1, 0x03, 0x0012, 0x0016}, {0x03, 0x03, -1, 0x03, 0x0012, 0x001e},
  {0x03, 0x04, -1, 0x03, 0x0012, 0x0026}, {0x03, 0x04, -1, 0x03, 0x0012, 0x0036},
  {0x03, 0x01, -1, 0x03, 0x001a, 0x000a}, {0x03, 0x01, -1, 0x03, 0x001a, 0x000c},
  {0x03, 0x02, -1, 0x03, 0x001a, 0x000e}, {0x03, 0x02, -1, 0x03, 0x001a, 0x0012},
  {0x03, 0x03, -1, 0x03, 0x001a, 0x0016}, {0x03, 0x03, -1, 0x03, 0x001a, 0x001e},
  {0x03, 0x04, -1, 0x03, 0x001a, 0x0026}, {0x03, 0x04, -1, 0x03, 0x001a, 0x0036},
  {0x04, 0x01, -1, 0x03, 0x0022, 0x000a}, {0x04, 0x01, -1, 0x03, 0x0022, 0x000c},
  {0x04, 0x02, -1, 0x03, 0x0022, 0x000e}, {0x04, 0x02, -1, 0x03, 0x0022, 0x0012},
  {0x04, 0x03, -1, 0x03, 0x0022, 0x0016}, {0x04, 0x03, -1, 0x03, 0x0022, 0x001e},
  {0x04, 0x04, -1, 0x03, 0x0022, 0x0026}, {0x04, 0x04, -1, 0x03, 0x0022, 0x0036},
  {0x04, 0x01, -1, 0x03, 0x0032, 0x000a}, {0x04, 0x01, -1, 0x03, 0x0032, 0x000c},
  {0x04, 0x02, -1, 0x03, 0x0032, 0x000e}, {0x04, 0x02, -1, 0x03, 0x0032, 0x0012},
  {0x04, 0x03, -1, 0x03, 0x0032, 0x0016}, {0x04, 0x03, -1, 0x03, 0x0032, 0x001e},
  {0x04, 0x04, -1, 0x03, 0x0032, 0x0026}, {0x04, 0x04, -1, 0x03, 0x0032, 0x0036},
  {0x05, 0x01, -1, 0x03, 0x0042, 0x000a}, {0x05, 0x01, -1, 0x03, 0x0042, 0x000c},
  {0x05, 0x02, -1, 0x03, 0x0042, 0x000e}, {0x05, 0x02, -1, 0x03, 0x0042, 0x0012},
  {0x05, 0x03, -1, 0x03, 0x0042, 0x0016}, {0x05, 0x03, -1, 0x03, 0x0042, 0x001e},
  {0x05, 0x04, -1, 0x03, 0x0042, 0x0026}, {0x05, 0x04, -1, 0x03, 0x0042, 0x0036},
  {0x05, 0x01, -1, 0x03, 0x0062, 0x000a}, {0x05, 0x01, -1, 0x03, 0x0062, 0x000c},
  {0x05, 0x02, -1, 0x03, 0x0062, 0x000e}, {0x05, 0x02, -1, 0x03, 0x0062, 0x0012},
  {0x05, 0x03, -1, 0x03, 0x0062, 0x0016}, {0x05, 0x03, -1, 0x03, 0x0062, 0x001e},
  {0x05, 0x04, -1, 0x03, 0x0062, 0x0026}, {0x05, 0x04, -1, 0x03, 0x0062, 0x0036},
  {0x00, 0x05, -1, 0x03, 0x0000, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0000, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0000, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0000, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0000, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0000, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0000, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0000, 0x0846},
  {0x00, 0x05, -1, 0x03, 0x0001, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0001, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0001, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0001, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0001, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0001, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0001, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0001, 0x0846},
  {0x00, 0x05, -1, 0x03, 0x0002, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0002, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0002, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0002, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0002, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0002, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0002, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0002, 0x0846},
  {0x00, 0x05, -1, 0x03, 0x0003, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0003, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0003, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0003, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0003, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0003, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0003, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0003, 0x0846},
  {0x00, 0x05, -1, 0x03, 0x0004, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0004, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0004, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0004, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0004, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0004, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0004, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0004, 0x0846},
  {0x00, 0x05, -1, 0x03, 0x0005, 0x0046}, {0x00, 0x05, -1, 0x03, 0x0005, 0x0066},
  {0x00, 0x06, -1, 0x03, 0x0005, 0x0086}, {0x00, 0x07, -1, 0x03, 0x0005, 0x00c6},
  {0x00, 0x08, -1, 0x03, 0x0005, 0x0146}, {0x00, 0x09, -1, 0x03, 0x0005, 0x0246},
  {0x00, 0x0a, -1, 0x03, 0x0005, 0x0446}, {0x00, 0x18, -1, 0x03, 0x0005, 0x0846},
  {0x01, 0x05, -1, 0x03, 0x0006, 0x0046}, {0x01, 0x05, -1, 0x03, 0x0006, 0x0066},
  {0x01, 0x06, -1, 0x03, 0x0006, 0x0086}, {0x01, 0x07, -1, 0x03, 0x0006, 0x00c6},
  {0x01, 0x08, -1, 0x03, 0x0006, 0x0146}, {0x01, 0x09, -1, 0x03, 0x0006, 0x0246},
  {0x01, 0x0a, -1, 0x03, 0x0006, 0x0446}, {0x01, 0x18, -1, 0x03, 0x0006, 0x0846},
  {0x01, 0x05, -1, 0x03, 0x0008, 0x0046}, {0x01, 0x05, -1, 0x03, 0x0008, 0x0066},
  {0x01, 0x06, -1, 0x03, 0x0008, 0x0086}, {0x01, 0x07, -1, 0x03, 0x0008, 0x00c6},
  {0x01, 0x08, -1, 0x03, 0x0008, 0x0146}, {0x01, 0x09, -1, 0x03, 0x0008, 0x0246},
  {0x01, 0x0a, -1, 0x03, 0x0008, 0x0446}, {0x01, 0x18, -1, 0x03, 0x0008, 0x0846},
  {0x06, 0x00, -1, 0x00, 0x0082, 0x0002}, {0x06, 0x00, -1, 0x01, 0x0082, 0x0003},
  {0x06, 0x00, -1, 0x02, 0x0082, 0x0004}, {0x06, 0x00, -1, 0x03, 0x0082, 0x0005},
  {0x06, 0x00, -1, 0x03, 0x0082, 0x0006}, {0x06, 0x00, -1, 0x03, 0x0082, 0x0007},
  {0x06, 0x00, -1, 0x03, 0x0082, 0x0008}, {0x06, 0x00, -1, 0x03, 0x0082, 0x0009},
  {0x07, 0x00, -1, 0x00, 0x00c2, 0x0002}, {0x07, 0x00, -1, 0x01, 0x00c2, 0x0003},
  {0x07, 0x00, -1, 0x02, 0x00c2, 0x0004}, {0x07, 0x00, -1, 0x03, 0x00c2, 0x0005},
  {0x07, 0x00, -1, 0x03, 0x00c2, 0x0006}, {0x07, 0x00, -1, 0x03, 0x00c2, 0x0007},
  {0x07, 0x00, -1, 0x03, 0x00c2, 0x0008}, {0x07, 0x00, -1, 0x03, 0x00c2, 0x0009},
  {0x08, 0x00, -1, 0x00, 0x0142, 0x0002}, {0x08, 0x00, -1, 0x01, 0x0142, 0x0003},
  {0x08, 0x00, -1, 0x02, 0x0142, 0x0004}, {0x08, 0x00, -1, 0x03, 0x0142, 0x0005},
  {0x08, 0x00, -1, 0x03, 0x0142, 0x0006}, {0x08, 0x00, -1, 0x03, 0x0142, 0x0007},
  {0x08, 0x00, -1, 0x03, 0x0142, 0x0008}, {0x08, 0x00, -1, 0x03, 0x0142, 0x0009},
  {0x09, 0x00, -1, 0x00, 0x0242, 0x0002}, {0x09, 0x00, -1, 0x01, 0x0242, 0x0003},
  {0x09, 0x00, -1, 0x02, 0x0242, 0x0004}, {0x09, 0x00, -1, 0x03, 0x0242, 0x0005},
  {0x09, 0x00, -1, 0x03, 0x0242, 0x0006}, {0x09, 0x00, -1, 0x03, 0x0242, 0x0007},
  {0x09, 0x00, -1, 0x03, 0x0242, 0x0008}, {0x09, 0x00, -1, 0x03, 0x0242, 0x0009},
  {0x0a, 0x00, -1, 0x00, 0x0442, 0x0002}, {0x0a, 0x00, -1, 0x01, 0x0442, 0x0003},
  {0x0a, 0x00, -1, 0x02, 0x0442, 0x0004}, {0x0a, 0x00, -1, 0x03, 0x0442, 0x0005},
  {0x0a, 0x00, -1, 0x03, 0x0442, 0x0006}, {0x0a, 0x00, -1, 0x03, 0x0442, 0x0007},
  {0x0a, 0x00, -1, 0x03, 0x0442, 0x0008}, {0x0a, 0x00, -1, 0x03, 0x0442, 0x0009},
  {0x0c, 0x00, -1, 0x00, 0x0842, 0x0002}, {0x0c, 0x00, -1, 0x01, 0x0842, 0x0003},
  {0x0c, 0x00, -1, 0x02, 0x0842, 0x0004}, {0x0c, 0x00, -1, 0x03, 0x0842, 0x0005},
  {0x0c, 0x00, -1, 0x03, 0x0842, 0x0006}, {0x0c, 0x00, -1, 0x03, 0x0842, 0x0007},
  {0x0c, 0x00, -1, 0x03, 0x0842, 0x0008}, {0x0c, 0x00, -1, 0x03, 0x0842, 0x0009},
  {0x0e, 0x00, -1, 0x00, 0x1842, 0x0002}, {0x0e, 0x00, -1, 0x01, 0x1842, 0x0003},
  {0x0e, 0x00, -1, 0x02, 0x1842, 0x0004}, {0x0e, 0x00, -1, 0x03, 0x1842, 0x0005},
  {0x0e, 0x00, -1, 0x03, 0x1842, 0x0006}, {0x0e, 0x00, -1, 0x03, 0x1842, 0x0007},
  {0x0e, 0x00, -1, 0x03, 0x1842, 0x0008}, {0x0e, 0x00, -1, 0x03, 0x1842, 0x0009},
  {0x18, 0x00, -1, 0x00, 0x5842, 0x0002}, {0x18, 0x00, -1, 0x01, 0x5842, 0x0003},
  {0x18, 0x00, -1, 0x02, 0x5842, 0x0004}, {0x18, 0x00, -1, 0x03, 0x5842, 0x0005},
  {0x18, 0x00, -1, 0x03, 0x5842, 0x0006}, {0x18, 0x00, -1, 0x03, 0x5842, 0x0007},
  {0x18, 0x00, -1, 0x03, 0x5842, 0x0008}, {0x18, 0x00, -1, 0x03, 0x5842, 0x0009},
  {0x02, 0x05, -1, 0x03, 0x000a, 0x0046}, {0x02, 0x05, -1, 0x03, 0x000a, 0x0066},
  {0x02, 0x06, -1, 0x03, 0x000a, 0x0086}, {0x02, 0x07, -1, 0x03, 0x000a, 0x00c6},
  {0x02, 0x08, -1, 0x03, 0x000a, 0x0146}, {0x02, 0x09, -1, 0x03, 0x000a, 0x0246},
  {0x02, 0x0a, -1, 0x03, 0x000a, 0x0446}, {0x02, 0x18, -1, 0x03, 0x000a, 0x0846},
  {0x02, 0x05, -1, 0x03, 0x000e, 0x0046}, {0x02, 0x05, -1, 0x03, 0x000e, 0x0066},
  {0x02, 0x06, -1, 0x03, 0x000e, 0x0086}, {0x02, 0x07, -1, 0x03, 0x000e, 0x00c6},
  {0x02, 0x08, -1, 0x03, 0x000e, 0x0146}, {0x02, 0x09, -1, 0x03, 0x000e, 0x0246},
  {0x02, 0x0a, -1, 0x03, 0x000e, 0x0446}, {0x02, 0x18, -1, 0x03, 0x000e, 0x0846},
  {0x03, 0x05, -1, 0x03, 0x0012, 0x0046}, {0x03, 0x05, -1, 0x03, 0x0012, 0x0066},
  {0x03, 0x06, -1, 0x03, 0x0012, 0x0086}, {0x03, 0x07, -1, 0x03, 0x0012, 0x00c6},
  {0x03, 0x08, -1, 0x03, 0x0012, 0x0146}, {0x03, 0x09, -1, 0x03, 0x0012, 0x0246},
  {0x03, 0x0a, -1, 0x03, 0x0012, 0x0446}, {0x03, 0x18, -1, 0x03, 0x0012, 0x0846},
  {0x03, 0x05, -1, 0x03, 0x001a, 0x0046}, {0x03, 0x05, -1, 0x03, 0x001a, 0x0066},
  {0x03, 0x06, -1, 0x03, 0x001a, 0x0086}, {0x03, 0x07, -1, 0x03, 0x001a, 0x00c6},
  {0x03, 0x08, -1, 0x03, 0x001a, 0x0146}, {0x03, 0x09, -1, 0x03, 0x001a, 0x0246},
  {0x03, 0x0a, -1, 0x03, 0x001a, 0x0446}, {0x03, 0x18, -1, 0x03, 0x001a, 0x0846},
  {0x04, 0x05, -1, 0x03, 0x0022, 0x0046}, {0x04, 0x05, -1, 0x03, 0x0022, 0x0066},
  {0x04, 0x06, -1, 0x03, 0x0022, 0x0086}, {0x04, 0x07, -1, 0x03, 0x0022, 0x00c6},
  {0x04, 0x08, -1, 0x03, 0x0022, 0x0146}, {0x04, 0x09, -1, 0x03, 0x0022, 0x0246},
  {0x04, 0x0a, -1, 0x03, 0x0022, 0x0446}, {0x04, 0x18, -1, 0x03, 0x0022, 0x0846},
  {0x04, 0x05, -1, 0x03, 0x0032, 0x0046}, {0x04, 0x05, -1, 0x03, 0x0032, 0x0066},
  {0x04, 0x06, -1, 0x03, 0x0032, 0x0086}, {0x04, 0x07, -1, 0x03, 0x0032, 0x00c6},
  {0x04, 0x08, -1, 0x03, 0x0032, 0x0146}, {0x04, 0x09, -1, 0x03, 0x0032, 0x0246},
  {0x04, 0x0a, -1, 0x03, 0x0032, 0x0446}, {0x04, 0x18, -1, 0x03, 0x0032, 0x0846},
  {0x05, 0x05, -1, 0x03, 0x0042, 0x0046}, {0x05, 0x05, -1, 0x03, 0x0042, 0x0066},
  {0x05, 0x06, -1, 0x03, 0x0042, 0x0086}, {0x05, 0x07, -1, 0x03, 0x0042, 0x00c6},
  {0x05, 0x08, -1, 0x03, 0x0042, 0x0146}, {0x05, 0x09, -1, 0x03, 0x0042, 0x0246},
  {0x05, 0x0a, -1, 0x03, 0x0042, 0x0446}, {0x05, 0x18, -1, 0x03, 0x0042, 0x0846},
  {0x05, 0x05, -1, 0x03, 0x0062, 0x0046}, {0x05, 0x05, -1, 0x03, 0x0062, 0x0066},
  {0x05, 0x06, -1, 0x03, 0x0062, 0x0086}, {0x05, 0x07, -1, 0x03, 0x0062, 0x00c6},
  {0x05, 0x08, -1, 0x03, 0x0062, 0x0146}, {0x05, 0x09, -1, 0x03, 0x0062, 0x0246},
  {0x05, 0x0a, -1, 0x03, 0x0062, 0x0446}, {0x05, 0x18, -1, 0x03, 0x0062, 0x0846},
  {0x06, 0x01, -1, 0x03, 0x0082, 0x000a}, {0x06, 0x01, -1, 0x03, 0x0082, 0x000c},
  {0x06, 0x02, -1, 0x03, 0x0082, 0x000e}, {0x06, 0x02, -1, 0x03, 0x0082, 0x0012},
  {0x06, 0x03, -1, 0x03, 0x0082, 0x0016}, {0x06, 0x03, -1, 0x03, 0x0082, 0x001e},
  {0x06, 0x04, -1, 0x03, 0x0082, 0x0026}, {0x06, 0x04, -1, 0x03, 0x0082, 0x0036},
  {0x07, 0x01, -1, 0x03, 0x00c2, 0x000a}, {0x07, 0x01, -1, 0x03, 0x00c2, 0x000c},
  {0x07, 0x02, -1, 0x03, 0x00c2, 0x000e}, {0x07, 0x02, -1, 0x03, 0x00c2, 0x0012},
  {0x07, 0x03, -1, 0x03, 0x00c2, 0x0016}, {0x07, 0x03, -1, 0x03, 0x00c2, 0x001e},
  {0x07, 0x04, -1, 0x03, 0x00c2, 0x0026}, {0x07, 0x04, -1, 0x03, 0x00c2, 0x0036},
  {0x08, 0x01, -1, 0x03, 0x0142, 0x000a}, {0x08, 0x01, -1, 0x03, 0x0142, 0x000c},
  {0x08, 0x02, -1, 0x03, 0x0142, 0x000e}, {0x08, 0x02, -1, 0x03, 0x0142, 0x0012},
  {0x08, 0x03, -1, 0x03, 0x0142, 0x0016}, {0x08, 0x03, -1, 0x03, 0x0142, 0x001e},
  {0x08, 0x04, -1, 0x03, 0x0142, 0x0026}, {0x08, 0x04, -1, 0x03, 0x0142, 0x0036},
  {0x09, 0x01, -1, 0x03, 0x0242, 0x000a}, {0x09, 0x01, -1, 0x03, 0x0242, 0x000c},
  {0x09, 0x02, -1, 0x03, 0x0242, 0x000e}, {0x09, 0x02, -1, 0x03, 0x0242, 0x0012},
  {0x09, 0x03, -1, 0x03, 0x0242, 0x0016}, {0x09, 0x03, -1, 0x03, 0x0242, 0x001e},
  {0x09, 0x04, -1, 0x03, 0x0242, 0x0026}, {0x09, 0x04, -1, 0x03, 0x0242, 0x0036},
  {0x0a, 0x01, -1, 0x03, 0x0442, 0x000a}, {0x0a, 0x01, -1, 0x03, 0x0442, 0x000c},
  {0x0a, 0x02, -1, 0x03, 0x0442, 0x000e}, {0x0a, 0x02, -1, 0x03, 0x0442, 0x0012},
  {0x0a, 0x03, -1, 0x03, 0x0442, 0x0016}, {0x0a, 0x03, -1, 0x03, 0x0442, 0x001e},
  {0x0a, 0x04, -1, 0x03, 0x0442, 0x0026}, {0x0a, 0x04, -1, 0x03, 0x0442, 0x0036},
  {0x0c, 0x01, -1, 0x03, 0x0842, 0x000a}, {0x0c, 0x01, -1, 0x03, 0x0842, 0x000c},
  {0x0c, 0x02, -1, 0x03, 0x0842, 0x000e}, {0x0c, 0x02, -1, 0x03, 0x0842, 0x0012},
  {0x0c, 0x03, -1, 0x03, 0x0842, 0x0016}, {0x0c, 0x03, -1, 0x03, 0x0842, 0x001e},
  {0x0c, 0x04, -1, 0x03, 0x0842, 0x0026}, {0x0c, 0x04, -1, 0x03, 0x0842, 0x0036},
  {0x0e, 0x01, -1, 0x03, 0x1842, 0x000a}, {0x0e, 0x01, -1, 0x03, 0x1842, 0x000c},
  {0x0e, 0x02, -1, 0x03, 0x1842, 0x000e}, {0x0e, 0x02, -1, 0x03, 0x1842, 0x0012},
  {0x0e, 0x03, -1, 0x03, 0x1842, 0x0016}, {0x0e, 0x03, -1, 0x03, 0x1842, 0x001e},
  {0x0e, 0x04, -1, 0x03, 0x1842, 0x0026}, {0x0e, 0x04, -1, 0x03, 0x1842, 0x0036},
  {0x18, 0x01, -1, 0x03, 0x5842, 0x000a}, {0x18, 0x01, -1, 0x03, 0x5842, 0x000c},
  {0x18, 0x02, -1, 0x03, 0x5842, 0x000e}, {0x18, 0x02, -1, 0x03, 0x5842, 0x0012},
  {0x18, 0x03, -1, 0x03, 0x5842, 0x0016}, {0x18, 0x03, -1, 0x03, 0x5842, 0x001e},
  {0x18, 0x04, -1, 0x03, 0x5842, 0x0026}, {0x18, 0x04, -1, 0x03, 0x5842, 0x0036},
  {0x06, 0x05, -1, 0x03, 0x0082, 0x0046}, {0x06, 0x05, -1, 0x03, 0x0082, 0x0066},
  {0x06, 0x06, -1, 0x03, 0x0082, 0x0086}, {0x06, 0x07, -1, 0x03, 0x0082, 0x00c6},
  {0x06, 0x08, -1, 0x03, 0x0082, 0x0146}, {0x06, 0x09, -1, 0x03, 0x0082, 0x0246},
  {0x06, 0x0a, -1, 0x03, 0x0082, 0x0446}, {0x06, 0x18, -1, 0x03, 0x0082, 0x0846},
  {0x07, 0x05, -1, 0x03, 0x00c2, 0x0046}, {0x07, 0x05, -1, 0x03, 0x00c2, 0x0066},
  {0x07, 0x06, -1, 0x03, 0x00c2, 0x0086}, {0x07, 0x07, -1, 0x03, 0x00c2, 0x00c6},
  {0x07, 0x08, -1, 0x03, 0x00c2, 0x0146}, {0x07, 0x09, -1, 0x03, 0x00c2, 0x0246},
  {0x07, 0x0a, -1, 0x03, 0x00c2, 0x0446}, {0x07, 0x18, -1, 0x03, 0x00c2, 0x0846},
  {0x08, 0x05, -1, 0x03, 0x0142, 0x0046}, {0x08, 0x05, -1, 0x03, 0x0142, 0x0066},
  {0x08, 0x06, -1, 0x03, 0x0142, 0x0086}, {0x08, 0x07, -1, 0x03, 0x0142, 0x00c6},
  {0x08, 0x08, -1, 0x03, 0x0142, 0x0146}, {0x08, 0x09, -1, 0x03, 0x0142, 0x0246},
  {0x08, 0x0a, -1, 0x03, 0x0142, 0x0446}, {0x08, 0x18, -1, 0x03, 0x0142, 0x0846},
  {0x09, 0x05, -1, 0x03, 0x0242, 0x0046}, {0x09, 0x05, -1, 0x03, 0x0242, 0x0066},
  {0x09, 0x06, -1, 0x03, 0x0242, 0x0086}, {0x09, 0x07, -1, 0x03, 0x0242, 0x00c6},
  {0x09, 0x08, -1, 0x03, 0x0242, 0x0146}, {0x09, 0x09, -1, 0x03, 0x0242, 0x0246},
  {0x09, 0x0a, -1, 0x03, 0x0242, 0x0446}, {0x09, 0x18, -1, 0x03, 0x0242, 0x0846},
  {0x0a, 0x05, -1, 0x03, 0x0442, 0x0046}, {0x0a, 0x05, -1, 0x03, 0x0442, 0x0066},
  {0x0a, 0x06, -1, 0x03, 0x0442, 0x0086}, {0x0a, 0x07, -1, 0x03, 0x0442, 0x00c6},
  {0x0a, 0x08, -1, 0x03, 0x0442, 0x0146}, {0x0a, 0x09, -1, 0x03, 0x0442, 0x0246},
  {0x0a, 0x0a, -1, 0x03, 0x0442, 0x0446}, {0x0a, 0x18, -1, 0x03, 0x0442, 0x0846},
  {0x0c, 0x05, -1, 0x03, 0x0842, 0x0046}, {0x0c, 0x05, -1, 0x03, 0x0842, 0x0066},
  {0x0c, 0x06, -1, 0x03, 0x0842, 0x0086}, {0x0c, 0x07, -1, 0x03, 0x0842, 0x00c6},
  {0x0c, 0x08, -1, 0x03, 0x0842, 0x0146}, {0x0c, 0x09, -1, 0x03, 0x0842, 0x0246},
  {0x0c, 0x0a, -1, 0x03, 0x0842, 0x0446}, {0x0c, 0x18, -1, 0x03, 0x0842, 0x0846},
  {0x0e, 0x05, -1, 0x03, 0x1842, 0x0046}, {0x0e, 0x05, -1, 0x03, 0x1842, 0x0066},
  {0x0e, 0x06, -1, 0x03, 0x1842, 0x0086}, {0x0e, 0x07, -1, 0x03, 0x1842, 0x00c6},
  {0x0e, 0x08, -1, 0x03, 0x1842, 0x0146}, {0x0e, 0x09, -1, 0x03, 0x1842, 0x0246},
  {0x0e, 0x0a, -1, 0x03, 0x1842, 0x0446}, {0x0e, 0x18, -1, 0x03, 0x1842, 0x0846},
  {0x18, 0x05, -1, 0x03, 0x5842, 0x0046}, {0x18, 0x05, -1, 0x03, 0x5842, 0x0066},
  {0x18, 0x06, -1, 0x03, 0x5842, 0x0086}, {0x18, 0x07, -1, 0x03, 0x5842, 0x00c6},
  {0x18, 0x08, -1, 0x03, 0x5842, 0x0146}, {0x18, 0x09, -1, 0x03, 0x5842, 0x0246},
  {0x18, 0x0a, -1, 0x03, 0x5842, 0x0446}, {0x18, 0x18, -1, 0x03, 0x5842, 0x0846}};

CONSTANT uint8_t kCodeLengthCodeOrder[18] = {
  1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15};
CONSTANT uint8_t kCodeLengthPrefixLength[16] = {2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 3, 2, 2, 2, 4};
CONSTANT uint8_t kCodeLengthPrefixValue[16]  = {0, 4, 3, 2, 0, 4, 3, 1, 0, 4, 3, 2, 0, 4, 3, 5};

// Represents the range of values belonging to a prefix code: [offset, offset + 2^nbits)
CONSTANT uint16_t kBlockLengthPrefixCodeOffset[brotli_num_block_len_symbols] = {
  1,   5,   9,   13,  17,  25,  33,  41,  49,   65,   81,   97,   113,
  145, 177, 209, 241, 305, 369, 497, 753, 1265, 2289, 4337, 8433, 16625};
CONSTANT uint8_t kBlockLengthPrefixCodeBits[brotli_num_block_len_symbols] = {
  2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, 24};

// Maximum possible Huffman table size for an alphabet size of (index * 32),
// max code length 15 and root table bits 8.
CONSTANT uint16_t kMaxHuffmanTableSize[] = {
  256,  402,  436,  468,  500,  534,  566,  598,  630,  662,  694,  726,  758,
  790,  822,  854,  886,  920,  952,  984,  1016, 1048, 1080, 1112, 1144, 1176,
  1208, 1240, 1272, 1304, 1336, 1368, 1400, 1432, 1464, 1496, 1528};

constexpr int brotli_huffman_max_size_26  = 396;
constexpr int brotli_huffman_max_size_258 = 632;
// Max table size for context map
constexpr int brotli_huffman_max_size_272 = 646;

enum brotli_transform_type_e {
  BROTLI_TRANSFORM_IDENTITY        = 0,
  BROTLI_TRANSFORM_OMIT_LAST_1     = 1,
  BROTLI_TRANSFORM_OMIT_LAST_2     = 2,
  BROTLI_TRANSFORM_OMIT_LAST_3     = 3,
  BROTLI_TRANSFORM_OMIT_LAST_4     = 4,
  BROTLI_TRANSFORM_OMIT_LAST_5     = 5,
  BROTLI_TRANSFORM_OMIT_LAST_6     = 6,
  BROTLI_TRANSFORM_OMIT_LAST_7     = 7,
  BROTLI_TRANSFORM_OMIT_LAST_8     = 8,
  BROTLI_TRANSFORM_OMIT_LAST_9     = 9,
  BROTLI_TRANSFORM_UPPERCASE_FIRST = 10,
  BROTLI_TRANSFORM_UPPERCASE_ALL   = 11,
  BROTLI_TRANSFORM_OMIT_FIRST_1    = 12,
  BROTLI_TRANSFORM_OMIT_FIRST_2    = 13,
  BROTLI_TRANSFORM_OMIT_FIRST_3    = 14,
  BROTLI_TRANSFORM_OMIT_FIRST_4    = 15,
  BROTLI_TRANSFORM_OMIT_FIRST_5    = 16,
  BROTLI_TRANSFORM_OMIT_FIRST_6    = 17,
  BROTLI_TRANSFORM_OMIT_FIRST_7    = 18,
  BROTLI_TRANSFORM_OMIT_FIRST_8    = 19,
  BROTLI_TRANSFORM_OMIT_FIRST_9    = 20,
  BROTLI_NUM_TRANSFORM_TYPES  // Counts transforms, not a transform itself.
};

/* RFC 7932 transforms string data */
CONSTANT uint8_t kPrefixSuffix[217] = {
  0x01, 0x20, 0x02, 0x2C, 0x20, 0x08, 0x20, 0x6F, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x04, 0x20,
  0x6F, 0x66, 0x20, 0x02, 0x73, 0x20, 0x01, 0x2E, 0x05, 0x20, 0x61, 0x6E, 0x64, 0x20, 0x04, 0x20,
  0x69, 0x6E, 0x20, 0x01, 0x22, 0x04, 0x20, 0x74, 0x6F, 0x20, 0x02, 0x22, 0x3E, 0x01, 0x0A, 0x02,
  0x2E, 0x20, 0x01, 0x5D, 0x05, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x03, 0x20, 0x61, 0x20, 0x06, 0x20,
  0x74, 0x68, 0x61, 0x74, 0x20, 0x01, 0x27, 0x06, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x06, 0x20,
  0x66, 0x72, 0x6F, 0x6D, 0x20, 0x04, 0x20, 0x62, 0x79, 0x20, 0x01, 0x28, 0x06, 0x2E, 0x20, 0x54,
  0x68, 0x65, 0x20, 0x04, 0x20, 0x6F, 0x6E, 0x20, 0x04, 0x20, 0x61, 0x73, 0x20, 0x04, 0x20, 0x69,
  0x73, 0x20, 0x04, 0x69, 0x6E, 0x67, 0x20, 0x02, 0x0A, 0x09, 0x01, 0x3A, 0x03, 0x65, 0x64, 0x20,
  0x02, 0x3D, 0x22, 0x04, 0x20, 0x61, 0x74, 0x20, 0x03, 0x6C, 0x79, 0x20, 0x01, 0x2C, 0x02, 0x3D,
  0x27, 0x05, 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x07, 0x2E, 0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x05,
  0x20, 0x6E, 0x6F, 0x74, 0x20, 0x03, 0x65, 0x72, 0x20, 0x03, 0x61, 0x6C, 0x20, 0x04, 0x66, 0x75,
  0x6C, 0x20, 0x04, 0x69, 0x76, 0x65, 0x20, 0x05, 0x6C, 0x65, 0x73, 0x73, 0x20, 0x04, 0x65, 0x73,
  0x74, 0x20, 0x04, 0x69, 0x7A, 0x65, 0x20, 0x02, 0xC2, 0xA0, 0x04, 0x6F, 0x75, 0x73, 0x20, 0x05,
  0x20, 0x74, 0x68, 0x65, 0x20, 0x02, 0x65, 0x20, 0x00};

CONSTANT uint16_t kPrefixSuffixMap[50] = {
  0x00, 0x02, 0x05, 0x0E, 0x13, 0x16, 0x18, 0x1E, 0x23, 0x25, 0x2A, 0x2D, 0x2F,
  0x32, 0x34, 0x3A, 0x3E, 0x45, 0x47, 0x4E, 0x55, 0x5A, 0x5C, 0x63, 0x68, 0x6D,
  0x72, 0x77, 0x7A, 0x7C, 0x80, 0x83, 0x88, 0x8C, 0x8E, 0x91, 0x97, 0x9F, 0xA5,
  0xA9, 0xAD, 0xB2, 0xB7, 0xBD, 0xC2, 0xC7, 0xCA, 0xCF, 0xD5, 0xD8};

/* RFC 7932 transforms */
/* Each entry is a [prefix_id, transform, suffix_id] triplet. */
CONSTANT uint8_t kTransformsData[] = {
  49, BROTLI_TRANSFORM_IDENTITY,        49, 49, BROTLI_TRANSFORM_IDENTITY,        0,
  0,  BROTLI_TRANSFORM_IDENTITY,        0,  49, BROTLI_TRANSFORM_OMIT_FIRST_1,    49,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 0,  49, BROTLI_TRANSFORM_IDENTITY,        47,
  0,  BROTLI_TRANSFORM_IDENTITY,        49, 4,  BROTLI_TRANSFORM_IDENTITY,        0,
  49, BROTLI_TRANSFORM_IDENTITY,        3,  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 49,
  49, BROTLI_TRANSFORM_IDENTITY,        6,  49, BROTLI_TRANSFORM_OMIT_FIRST_2,    49,
  49, BROTLI_TRANSFORM_OMIT_LAST_1,     49, 1,  BROTLI_TRANSFORM_IDENTITY,        0,
  49, BROTLI_TRANSFORM_IDENTITY,        1,  0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 0,
  49, BROTLI_TRANSFORM_IDENTITY,        7,  49, BROTLI_TRANSFORM_IDENTITY,        9,
  48, BROTLI_TRANSFORM_IDENTITY,        0,  49, BROTLI_TRANSFORM_IDENTITY,        8,
  49, BROTLI_TRANSFORM_IDENTITY,        5,  49, BROTLI_TRANSFORM_IDENTITY,        10,
  49, BROTLI_TRANSFORM_IDENTITY,        11, 49, BROTLI_TRANSFORM_OMIT_LAST_3,     49,
  49, BROTLI_TRANSFORM_IDENTITY,        13, 49, BROTLI_TRANSFORM_IDENTITY,        14,
  49, BROTLI_TRANSFORM_OMIT_FIRST_3,    49, 49, BROTLI_TRANSFORM_OMIT_LAST_2,     49,
  49, BROTLI_TRANSFORM_IDENTITY,        15, 49, BROTLI_TRANSFORM_IDENTITY,        16,
  0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 49, 49, BROTLI_TRANSFORM_IDENTITY,        12,
  5,  BROTLI_TRANSFORM_IDENTITY,        49, 0,  BROTLI_TRANSFORM_IDENTITY,        1,
  49, BROTLI_TRANSFORM_OMIT_FIRST_4,    49, 49, BROTLI_TRANSFORM_IDENTITY,        18,
  49, BROTLI_TRANSFORM_IDENTITY,        17, 49, BROTLI_TRANSFORM_IDENTITY,        19,
  49, BROTLI_TRANSFORM_IDENTITY,        20, 49, BROTLI_TRANSFORM_OMIT_FIRST_5,    49,
  49, BROTLI_TRANSFORM_OMIT_FIRST_6,    49, 47, BROTLI_TRANSFORM_IDENTITY,        49,
  49, BROTLI_TRANSFORM_OMIT_LAST_4,     49, 49, BROTLI_TRANSFORM_IDENTITY,        22,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   49, 49, BROTLI_TRANSFORM_IDENTITY,        23,
  49, BROTLI_TRANSFORM_IDENTITY,        24, 49, BROTLI_TRANSFORM_IDENTITY,        25,
  49, BROTLI_TRANSFORM_OMIT_LAST_7,     49, 49, BROTLI_TRANSFORM_OMIT_LAST_1,     26,
  49, BROTLI_TRANSFORM_IDENTITY,        27, 49, BROTLI_TRANSFORM_IDENTITY,        28,
  0,  BROTLI_TRANSFORM_IDENTITY,        12, 49, BROTLI_TRANSFORM_IDENTITY,        29,
  49, BROTLI_TRANSFORM_OMIT_FIRST_9,    49, 49, BROTLI_TRANSFORM_OMIT_FIRST_7,    49,
  49, BROTLI_TRANSFORM_OMIT_LAST_6,     49, 49, BROTLI_TRANSFORM_IDENTITY,        21,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 1,  49, BROTLI_TRANSFORM_OMIT_LAST_8,     49,
  49, BROTLI_TRANSFORM_IDENTITY,        31, 49, BROTLI_TRANSFORM_IDENTITY,        32,
  47, BROTLI_TRANSFORM_IDENTITY,        3,  49, BROTLI_TRANSFORM_OMIT_LAST_5,     49,
  49, BROTLI_TRANSFORM_OMIT_LAST_9,     49, 0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 1,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 8,  5,  BROTLI_TRANSFORM_IDENTITY,        21,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   0,  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 10,
  49, BROTLI_TRANSFORM_IDENTITY,        30, 0,  BROTLI_TRANSFORM_IDENTITY,        5,
  35, BROTLI_TRANSFORM_IDENTITY,        49, 47, BROTLI_TRANSFORM_IDENTITY,        2,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 17, 49, BROTLI_TRANSFORM_IDENTITY,        36,
  49, BROTLI_TRANSFORM_IDENTITY,        33, 5,  BROTLI_TRANSFORM_IDENTITY,        0,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 21, 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 5,
  49, BROTLI_TRANSFORM_IDENTITY,        37, 0,  BROTLI_TRANSFORM_IDENTITY,        30,
  49, BROTLI_TRANSFORM_IDENTITY,        38, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   0,
  49, BROTLI_TRANSFORM_IDENTITY,        39, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   49,
  49, BROTLI_TRANSFORM_IDENTITY,        34, 49, BROTLI_TRANSFORM_UPPERCASE_ALL,   8,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 12, 0,  BROTLI_TRANSFORM_IDENTITY,        21,
  49, BROTLI_TRANSFORM_IDENTITY,        40, 0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 12,
  49, BROTLI_TRANSFORM_IDENTITY,        41, 49, BROTLI_TRANSFORM_IDENTITY,        42,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   17, 49, BROTLI_TRANSFORM_IDENTITY,        43,
  0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 5,  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   10,
  0,  BROTLI_TRANSFORM_IDENTITY,        34, 49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 33,
  49, BROTLI_TRANSFORM_IDENTITY,        44, 49, BROTLI_TRANSFORM_UPPERCASE_ALL,   5,
  45, BROTLI_TRANSFORM_IDENTITY,        49, 0,  BROTLI_TRANSFORM_IDENTITY,        33,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 30, 49, BROTLI_TRANSFORM_UPPERCASE_ALL,   30,
  49, BROTLI_TRANSFORM_IDENTITY,        46, 49, BROTLI_TRANSFORM_UPPERCASE_ALL,   1,
  49, BROTLI_TRANSFORM_UPPERCASE_FIRST, 34, 0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 33,
  0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   30, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   1,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   33, 49, BROTLI_TRANSFORM_UPPERCASE_ALL,   21,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   12, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   5,
  49, BROTLI_TRANSFORM_UPPERCASE_ALL,   34, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   12,
  0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 30, 0,  BROTLI_TRANSFORM_UPPERCASE_ALL,   34,
  0,  BROTLI_TRANSFORM_UPPERCASE_FIRST, 34,
};

CONSTANT int kNumTransforms = (int)(sizeof(kTransformsData) / (3 * sizeof(kTransformsData[0])));
